package com.izocen.rules.common;

import java.util.List;
import java.util.Map;

import com.izocen.rules.core.rule.RuleUnit;

/**
 *@ClassName EngineResponse
 * @Description: 调用引擎之后返回的结果封装
 * 执行引擎、添加规则、删除、更新、查询
 * @Author pengyongjun
 * @Date 2020年6月19日
 */
public class EngineResponse {
	
	
	private int matchCode ;
	
	/**
	 * 操作成功
	 */
	public static final int ENGINE_OP_RES_SUCC = 200;
	/**
	 * 操作失败
	 */
	public static final int ENGINE_OP_RES_FAIL = 500;
	
	
	/**
	 * 匹配成功
	 */
	public static final int ENGINE_MATCH_RES_SUCC = 200;
	/**
	 * 匹配失败
	 */
	public static final int ENGINE_MATCH_RES_FAIL = 500;
	
	/**
	 * 
	 */
	private int opCode;
	
	/**
	 * 
	 */
	private String msg;
	
	
	public int getMatchCode() {
		return matchCode;
	}

	public void setMatchCode(int matchCode) {
		this.matchCode = matchCode;
	}
	
	/**
	 * 执行引擎之后的结果
	 * key：
	 */
	private Map<String,List<String>> fireResult;
	
	/**
	 * 操作引擎之后的结果
	 */
	private List<RuleUnit> queryResult;

	
	public static EngineResponse ok_op() {
		EngineResponse er = new EngineResponse();
		er.setOpCode(ENGINE_OP_RES_SUCC);
		return er;
	}
	
	public static EngineResponse ok_query(List<RuleUnit> list) {
		EngineResponse er = new EngineResponse();
		er.setOpCode(ENGINE_OP_RES_SUCC);
		er.setQueryResult(list);
		return er;
	}
	
	public static EngineResponse fail_op(String msg) {
		EngineResponse er = new EngineResponse();
		er.setOpCode(ENGINE_OP_RES_FAIL);
		er.setMsg(msg);
		return er;
	}
    

	public int getOpCode() {
		return opCode;
	}

	public void setOpCode(int opCode) {
		this.opCode = opCode;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Map<String, List<String>> getFireResult() {
		return fireResult;
	}

	public void setFireResult(Map<String, List<String>> fireResult) {
		this.fireResult = fireResult;
	}

	public List<RuleUnit> getQueryResult() {
		return queryResult;
	}

	public void setQueryResult(List<RuleUnit> queryResult) {
		this.queryResult = queryResult;
	}

	
}
